<template>
  <div>
    <div v-if="!uaShow" style="text-align: center; padding-top: 20px">请在浙政钉中打开</div>
    <div v-if="uaShow" class="main">
      <div class="w">
        <!--简介-->
        <hyt-board1 @on-click="cockpitClick"></hyt-board1>
        <!--核心指标-->
        <hyt-board2c></hyt-board2c>
        <!--痛点与难点-->
        <hyt-board3b></hyt-board3b>
        <!--多跨协同-->
        <hyt-board4></hyt-board4>
        <!--系统介绍-->
        <hyt-videoc></hyt-videoc>
        <!--应用成效-->
        <!--<hyt-board5></hyt-board5>-->
        <!--流程再造-->
        <hyt-board6></hyt-board6>
        <!--规范建设-->
        <hyt-board7></hyt-board7>
        <!--工作专班-->
        <!--<hyt-board8></hyt-board8>-->
        <!--理论/制度/推广成果-->
        <hyt-board9></hyt-board9>
        <!--<a-row :gutter="16">
          <a-col :span="12">
          </a-col>
          <a-col :span="12">
          </a-col>
        </a-row>-->
      </div>
      <div v-if="iframeVisible" class="iframeBox">
        <a-icon type="close-circle" class="close" @click="closeIframe" />
        <iframe class="iframe" v-once :src="iframeUrl" style="width: 100%; height: 100%" frameborder="0"></iframe>
      </div>
    </div>
  </div>
</template>

<script>
  import hytBoard1 from './components/hytBoard1'
  import hytBoard2c from './components/hytBoard2c'
  import hytBoard3b from './components/hytBoard3b'
  import hytBoard4 from './components/hytBoard4'
  import hytBoard5 from './components/hytBoard5'
  import hytBoard6 from './components/hytBoard6'
  import hytBoard7 from './components/hytBoard7'
  import hytBoard8 from './components/hytBoard8'
  import hytBoard9 from './components/hytBoard9'
  import hytVideoc from './components/hytVideoc'
  export default {
    name: 'Index',
    components: { hytBoard1, hytBoard2c, hytBoard3b, hytBoard4, hytBoard5, hytBoard6, hytBoard7, hytBoard8, hytBoard9, hytVideoc },
    data () {
      return {
        uaShow: true,
        iframeVisible: false,
        iframeUrl: 'https://hyt.dongyang.gov.cn:4443/shanhaibi/hdyswh/' // 'https://hyt.dongyang.gov.cn/largeScreen'
      }
    },
    created () {
      // 判断浙政钉环境 production
      // this.toJmzkDp()
      // if (process.env.NODE_ENV === 'production') {
      //   this.toJmzkDp()
      // } else {
      //   this.uaShow = true
      // }
    },
    methods: {
      cockpitClick () {
        this.iframeVisible = true
      },
      closeIframe () {
        this.iframeVisible = false
      },
      toJmzkDp () {
        const jmzkDpUrl = 'http://10.45.207.29:8088/#/home'
        const ua = navigator.userAgent.toLowerCase()
        if (ua.indexOf('taurusapp') != -1) {
          console.log('浙政钉环境')
          this.uaShow = true
        } else {
          console.log('非浙政钉环境')
          this.uaShow = false
          window.location.href = jmzkDpUrl
          // window.url(jmzkDpUrl)
        }
         // window.open('http://10.45.207.29:8088/#/home')
        /* const jmzkDpUrl = 'http://10.45.207.29:8088/#/home'
        openLink({
          url: jmzkDpUrl.includes('?') ? `${jmzkDpUrl}&ddtab=true` : `${jmzkDpUrl}&ddtab=true`,
          params: {}
        }).catch(() => {
          // api 调用失败说明不是浙政钉环境
          // 非浙政钉环境打开浏览器新页面
          window.open('jmzkDpUrl', '_blank')
        }) */
      }
    }
  }
</script>

<style scoped lang="less">
  .main {
    width: 100%;
    background: #d4e6fc url("~@/assets/img/bg.jpg") center top no-repeat;
    background-size: 100% auto;
    padding-top: 200px;
    overflow: hidden;
    .w {
      width: 92%; min-width: 1200px; padding-bottom: 1px;
      margin: auto
    }
  }
  .iframeBox {position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 99999; background-color: #020308;}
  .iframe {position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 3333}
  .close { color: #fff; position: absolute; top: 20px; right: 20px; z-index: 6666; font-size: 30px; cursor: pointer}
</style>
